package top.usts.springframework.bean;


import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * @description:
 * @author: CJ
 * @date: 2022/2/25
 */
public class UserServiceInterceptor implements MethodInterceptor {

    @Override
    public Object invoke(MethodInvocation invocation) throws Throwable {

        long start = System.currentTimeMillis();
        try{
            return invocation.proceed();
        }finally {
            System.out.println("监控 -begin by aop");
            System.out.println("方法名称 " + invocation.getMethod());
            System.out.println("方法好事"+(System.currentTimeMillis() - start));
            System.out.println("监控 - end");
        }
    }
}
